import Vue from 'vue'
import VueRouter from 'vue-router'

// 导入登录注册组件
// import Reg from '@/views/Reg/Reg.vue'
const Reg = () => import('@/views/Reg/Reg.vue')
// import Login from '@/views/Login/Login.vue'
const Login = () => import('@/views/Login/Login.vue')
// import Main from '@/views/Main/Main.vue'
const Main = () => import('@/views/Main/Main.vue')

// import Home from '@/views/menus/Home/Home.vue'
const Home = () => import('@/views/menus/Home/Home.vue')

// import userInfo from '@/views/menus/User/UserInfo.vue'
const userInfo = () => import('@/views/menus/User/UserInfo.vue')

// import UserAvatar from '@/views/menus/User/UserAvatar.vue'
const UserAvatar = () => import('@/views/menus/User/UserAvatar.vue')

// import UserPwd from '@/views/menus/User/UserPwd.vue'
const UserPwd = () => import('@/views/menus/User/UserPwd.vue')

// import ArtCate from '@/views/menus/Article/ArtCate.vue'
const ArtCate = () => import('@/views/menus/Article/ArtCate.vue')

// import ArtList from '@/views/menus/Article/ArtList.vue'
const ArtList = () => import('@/views/menus/Article/ArtList.vue')

Vue.use(VueRouter)

const routes = [
  { path: '/reg', component: Reg },
  { path: '/login', component: Login },
  {
    path: '/',
    component: Main,
    redirect: '/home',
    children: [
      { path: 'home', component: Home },
      { path: 'user-info', component: userInfo },
      { path: 'user-avatar', component: UserAvatar },
      { path: 'user-pwd', component: UserPwd },
      { path: 'art-cate', component: ArtCate },
      { path: 'art-list', component: ArtList }
    ]
  }
]

const router = new VueRouter({
  routes
})

export default router
